<template>
	<view>
		<text class="hqy" @click="submit('获取验证码')">
			<text v-if="!cl">{{number+'s'}}</text>
			{{text}}</text>
	</view>
</template>

<script>
	export default {
		name: "daojishi",
		props: {
			text: {
				type: String,
				default: '获取验证码'
			},
		},
		data() {
			return {
				number: 60,
				cl: true,
			};
		},
		methods: {
			countdown() {
				if (this.number == 0) {
					this.cl = true
					return false;
				} else {
					this.number--;
				}
				setTimeout(() => {
					this.countdown();
				}, 1000);
			},
			sing() {
				this.cl = false
				this.countdown()
			},
			submit() {

			},
		}
	}
</script>

<style lang="scss">

</style>
